package com.syq;

import com.syq.mapper.DeptMapper;
import com.syq.mapper.PassengerMapper;
import com.syq.mapper.StudentMapper;
import com.syq.pojo.Dept;
import com.syq.pojo.Passenger;
import com.syq.pojo.Student;
import com.syq.utils.MyBatisUtils;
import org.junit.Test;

import java.util.List;

/**
 * @ClassName: testOne2One
 * @Description: TODO
 * @Create by: syq
 * @Date: 5/7/2022 下午2:43
 */


public class testORM {

    @Test
    public void testOne2One() {
        PassengerMapper passengerMapper = MyBatisUtils.getMapper(PassengerMapper.class);
        List<Passenger> passengerList = passengerMapper.findAll();
        System.out.println(passengerList);
    }

    @Test
    public void testOne2Many() {
        DeptMapper deptMapper = MyBatisUtils.getMapper(DeptMapper.class);
        List<Dept> deptList = deptMapper.findAll();
        for (Dept dept : deptList) {
            System.out.println(dept);
        }
    }

    @Test
    public void testMany2Many() {
        StudentMapper studentMapper = MyBatisUtils.getMapper(StudentMapper.class);
        List<Student> studentList = studentMapper.findMany2Many();
        for (Student student : studentList) {
            System.out.println(student);
        }
    }
}
